﻿using System.Collections;
using System.Diagnostics;

namespace WebApiSampleTemplate.Extensions.Utils
{
    /// <summary>
    /// 集合扩展方法
    /// </summary>
    public static class CollectExtentions
    {
        /// <summary>
        /// 空集合判断
        /// </summary>
        [DebuggerStepThrough]
        public static bool IsEmpty(this IEnumerable value)
        {
            return value == null || !value.GetEnumerator().MoveNext();
        }
        /// <summary>
        /// 非空集合判断
        /// </summary>
        [DebuggerStepThrough]
        public static bool HasValues(this IEnumerable value)
        {
            return value != null && value.GetEnumerator().MoveNext();
        }
    }
}
